home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / DOPbt2 / 2 / fileshowV3.1 / FileShowV3.1 < prev   
Text File  |  1994-05-31  |  10KB  |  353 lines

  1. /* Optimized with RexxOpt 1.5 */
  2. FileShowVersion="$VER: FileShow 3.1 ()"
  3. signal on syntax
  4. options results
  5. options failat 21
  6. parse arg port
  7. if upper(port)="?" then do
  8. say "USE only from within DOPUS"
  9. say "FileShow V3.0"
  10. say "Lamer Alert! Better read the guide dombo."
  11. exit
  12. end
  13. ScanDirFlag=""
  14. Uno="dest"
  15. Dos="ram:"
  16. call Openfilelist
  17. RescanFlag=0
  18. do v=1 to aantal
  19. SearchFile=SearchFile.v
  20. File=SearchFile.v
  21. Archtype=right(SearchFile.v,3)
  22. call CHECKABORTUS
  23. select
  24. when Archtype="LHA" then Gadgets=Smalltitle||'|'||"COPY"||'|'||Archtype||'|'||"DEL"||'|'||"ex ID"||''
  25. when Archtype="DMS" then Gadgets=SmallTitle||'|'||"COPY"||'|'||Archtype||'|'||"DEL"
  26. when Archtype="LZH" then Gadgets=Smalltitle||'|'||"COPY"||'|'||Archtype||'|'||"DEL"
  27. when Archtype="ZIP" then Gadgets=Smalltitle||'|'||"COPY"||'|'||Archtype||'|'||"DEL"
  28. otherwise Gadgets=Smalltitle||'|'||"COPY"||'|'||Archtype||'|'||"DEL"
  29. end
  30. SelectedFile=TCTC||PathFile||File||TCTC
  31. if exists('T:FILE_ID.DIZ')then address command 'delete T:FILE_ID.DIZ quiet'
  32. if Showtext.v="No FILE_ID.DIZ" then
  33. do
  34. ne||"For "File
  35. SELECT
  36. WHEN ArchType='DMS' THEN ADDRESS command 'dmsdescript > NIL: x T:FILE_ID.diz '||SelectedFile
  37. WHEN ArchType='LHA' THEN ADDRESS command 'lha x > NIL: '||SelectedFile||' FILE_ID.DIZ T:'
  38. WHEN ArchType='LZH' THEN ADDRESS command 'lha x > NIL: '||SelectedFile||' FILE_ID.DIZ T:'
  39. WHEN ArchType='TXT' THEN ADDRESS command 'TxtExtract e > NIL: T:FILE_ID.DIZ '||SelectedFile
  40. WHEN ArchType='DOK' THEN ADDRESS command 'TxtExtract e > NIL: T:FILE_ID.DIZ '||SelectedFile
  41. WHEN ArchType='DOC' THEN ADDRESS command 'TxtExtract e > NIL: T:FILE_ID.DIZ '||SelectedFile
  42. WHEN ArchType='EXE' THEN ADDRESS command 'EXEDescript x > NIL: T:FILE_ID.DIZ '||SelectedFile
  43. WHEN ArchType='ZIP' THEN do
  44. olddirectory=pragma('D','T:')
  45. ADDRESS command 'Unzip > NIL: '||SelectedFile||'FILE_ID.DIZ '
  46. pragma('D',olddirectory)
  47. end
  48. OtherWise break
  49. END
  50. if ~ exists('T:FILE_ID.DIZ')then break
  51. Showtext.v=""
  52. call open('FileID','T:FILE_ID.diz','r')
  53. do until eof('FileID')
  54. Showtext.v=Showtext.v||newline||readln('FileID')
  55. end
  56. call close('FileID')
  57. end
  58. if v<10 then call writech FileShowWindow," "
  59. call writech FileShowWindow,v||"->"||SearchFile.v
  60. do t=length(SearchFile.v)to 12
  61. call writech fileShowWindow,' '
  62. end
  63. call ChoiceWindow
  64. address(port)
  65. if Window=0&ScanDirFlag ~="" then scandir ScanDirFlag ' 1'
  66. if Window=1&ScanDirFlag ~="" then scandir ScanDirFlag ' 0'
  67. if RescanFlag=5 then do
  68. rescan
  69. RescanFlag=0
  70. end
  71. end
  72. address(port)
  73. modify dirflags olddirflags
  74. Rescan
  75. address command wait 1
  76. exit
  77. ChoiceWindow:
  78. if Window=0 then actieresult=rtezrequest(Showtext.v,Gadgets,"",Tag3,actieresult)
  79. else actieresult=rtezrequest(Showtext.v,Gadgets,"",Tag4,actieresult)
  80. select
  81. when actieresult=1 then call Nothing
  82. when actieresult=2 then call Copying
  83. when actieresult=3&Archtype="DMS" then call DMS
  84. when actieresult=3&Archtype="LHA" then call LHA
  85. when actieresult=3&Archtype="LZH" then call LHA
  86. when actieresult=3&Archtype="ZIP" then call ZIP
  87. when actieresult=3 then call Other
  88. when actieresult=4 then call Deleting
  89. when actieresult=0 then call NIELS
  90. end
  91. return
  92. CHECKABORTUS:
  93. checkabort
  94. if result=1 then do
  95. breakresult=rtezrequest("Do You wanna have an abortion","YES|NO","",Tag1,breakresult)
  96. if breakresult=1 then do
  97. call writeln FileShowWindow,"User Abortion"
  98. exit
  99. end
  100. end
  101. return
  102. OpenFilelist:
  103. flag=Exists("Libs:rexxsupport.library")
  104. if flag=0 then do
  105. Say "! ERROR ! Libs:Rexxsupport.Library not Found."
  106. Exit
  107. end
  108. addlib("rexxsupport.library",0,-30)
  109. newline='0a'x
  110. TCTC='"'
  111. flag=Exists("Libs:rexxreqtools.library")
  112. if flag=0 then do
  113. say "! ERROR ! Libs:RexxReqTools.Library not Found."
  114. Exit
  115. end
  116. addlib("rexxreqtools.library",0,-30)
  117. if port='' then port=DOPUS.1
  118. Newshelltext="CON:80/290/505/65/FileShow Control Window/CLOSE/NOSIZE/SCREEN"||port
  119. Outputtext=" >"||TCTC||"CON:50/160/548/141/FileShow Output Window/CLOSE/NOSIZE/SCREEN"||port||TCTC
  120. call open FileShowWindow,Newshelltext
  121. if ~ result then do
  122. say "Open failed .... sukkel"
  123. exit
  124. end
  125. Tag0="rt_reqpos=reqpos_centerscr "
  126. TagL="rt_reqpos=reqpos_topleftscr rt_leftoffset=330 rt_topoffset=100 "
  127. TagR="rt_reqpos=reqpos_topleftscr rt_topoffset=100 "
  128. Tag2=Tag0||"rt_pubscrname="||port
  129. Tag3=TagL||"rt_pubscrname="||port
  130. Tag4=TagR||"rt_pubscrname="||port
  131. SmallTitle="Done"
  132. flag=Show(Ports,port)
  133. if flag=0 then do
  134. ErrorText="ERROR NO.50, Where the Bloody Hell is "port
  135. RC=50
  136. call Syntax
  137. end
  138. address(port)
  139. Uniconify
  140. dopustofront
  141. 'getselectedfiles / -1'
  142. Fileshowselects=result
  143. v=0
  144. do forever
  145. positie=index(FileShowselects,'/')
  146. if positie=0 then leave
  147. v=v+1
  148. SearchFile.v=left(FileShowselects,positie-1)
  149. FileShowselects=Delstr(FileShowselects,1,positie)
  150. end
  151. Aantal=v
  152. if aantal=0 then
  153. do
  154. ErrorText="ERROR NO.52, What the Bloody Hell am I looking for ? "
  155. RC=52
  156. call Syntax
  157. end
  158. none
  159. status 3
  160. Window=result
  161. 'status 13 -1'
  162. PathFile=result
  163. checkabort
  164. query dirflags
  165. olddirflags=result
  166. if olddirflags<0 then olddirflags=256+olddirflags
  167. if bittst(d2c(olddirflags),5)then do
  168. Modify DIRFLAGS olddirflags-32
  169. end
  170. flag=Exists("modules:rexx/FileShowData")
  171. if flag=0 then do
  172. call writeln FileShowWindow,"! ERROR ! dopus:modules/ext.modules/rexx/FileShowData not Found."
  173. address command
  174. wait 1
  175. Exit
  176. end
  177. call open('list','modules:rexx/FileShowData','r')
  178. y=-1
  179. do until eof('list')
  180. y=y+1
  181. list.y=readln('list')
  182. end
  183. call close('list')
  184. listend=list.0*2
  185. maxaantal=list.0
  186. call writeln FileShowWindow,"Found "||Aantal||" files in Dir ..."||PathFile||"›"
  187. do w=1 to aantal
  188. SearchFile.w=Upper(SearchFile.w)
  189. call SearchFilename
  190. end
  191. return
  192. syntax:
  193. if rc<49 then ErrorText="Syntax Error" rc"," errortext(rc)"in line" sigl"."i
  194. f rc ~=2 then rtezrequest(Errortext,,"",Tag0)
  195. say errortext
  196. exit
  197. SearchFilename:
  198. Showtext.w="No FILE_ID.DIZ"
  199. do z=1 to listend by 2
  200. if SearchFile.w=list.z then do
  201. s=z+1
  202. u=trunc(list.s/193/maxaantal-38744.5)
  203. d=u//10000
  204. e=(u-d)/10000+d-1
  205. Showtext.w=newline
  206. do x=d to e
  207. Showtext.w=Showtext.w||list.x||newline
  208. end
  209. Iterate
  210. end
  211. end
  212. return
  213. Nothing:
  214. call writeln FileShowWindow," --Didn't do anything"
  215. return
  216. Deleting:
  217. deletetext="Are YOU sure YOU wanna delete"||newline||SelectedFile
  218. deleteGadgets="DELETE IT|DONE"
  219. if Window=0 then delresult=rtezrequest(deletetext,deleteGadgets,"",Tag3,delresult)
  220. else delresult=rtezrequest(deletetext,deleteGadgets,"",Tag4,delresult)
  221. if delresult=1 then do
  222. call writeln FileShowWindow," ->DELETED "
  223. address command
  224. delete SelectedFile quiet
  225. RescanFlag=RescanFlag+1
  226. end
  227. else call writeln FileShowWindow," --Didn't Delete "
  228. return
  229. Copying:
  230. copytext="Where do YOU wanna copy archive to ?"||newline||SelectedFile
  231. copyGadgets="COPY "Uno"|COPY "Dos"|MOVE "Uno"|MOVE "Dos"|"Smalltitle
  232. if Window=0 then copresult=rtezrequest(copytext,copyGadgets,"",Tag3,copresult)
  233. else copresult=rtezrequest(copytext,copyGadgets,"",Tag4,copresult)
  234. if copresult=1 then do
  235. call writeln FileShowWindow," ->Copying to "||Uno
  236. address(port)
  237. 'copy' File Uno
  238. end
  239. if copresult=2 then do
  240. call writeln FileShowWindow," ->Copying to "||Dos
  241. address(port)
  242. 'copy' File Dos
  243. end
  244. if copresult=3 then do
  245. call writeln FileShowWindow," ->Moving to "||Uno
  246. address(port)
  247. 'move' File Uno
  248. RescanFlag=RescanFlag+1
  249. end
  250. if copresult=4 then do
  251. call writeln FileShowWindow," ->Moving to "||Dos
  252. address(port)
  253. 'move' File Dos
  254. RescanFlag=RescanFlag+1
  255. end
  256. if copresult=0 then call writeln FileShowWindow," --Didn't Copy or Move anything"
  257. return
  258. DMS:
  259. dmstext="Where do YOU wanna DMS to ?"||newline||SelectedFile
  260. dmsGadgets="DMS DF0:|DMS RAD:|DMS DF1:|DMS DF2:|"Smalltitle
  261. if Window=0 then dmsresult=rtezrequest(dmstext,dmsGadgets,"",Tag3,dmsresult)
  262. else dmsresult=rtezrequest(dmstext,dmsGadgets,"",Tag4,dmsresult)
  263. if dmsresult=1 then do
  264. call writeln FileShowWindow," ->DMS to DF0:"
  265. address command
  266. 'dms write' SelectedFile "to DF0: NOTEXT NOPAUSE"||Outputtext
  267. end
  268. if dmsresult=2 then do
  269. call writeln FileShowWindow," ->DMS to RAD:"
  270. address command
  271. if showlist('H','RAD')
  272. then call writeln FileShowWindow," RAD: already mounted"
  273. else do
  274. call writeln FileShowWindow," Mounting RAD:"
  275. 'mount RAD: from modules:rexx/FileShowRAD'
  276. end
  277. 'dms write' SelectedFile "to RAD: NOTEXT NOPAUSE"||Outputtext
  278. ScanDirFlag="RAD:"
  279. end
  280. if dmsresult=3 then do
  281. call writeln FileShowWindow," ->DMS to DF1:"
  282. address command
  283. 'dms write' SelectedFile "to DF1: NOTEXT NOPAUSE"||Outputtext
  284. end
  285. if dmsresult=4 then do
  286. call writeln FileShowWindow," ->DMS to DF2:"
  287. address command
  288. 'dms write' SelectedFile "to DF2: NOTEXT NOPAUSE"||Outputtext
  289. end
  290. if dmsresult=0 then call writeln FileShowWindow," --Didn't Dms anything"
  291. if rc ~=0 then do
  292. call writeln FileShowWindow,"›[0m DMS ERROR  -> "||result
  293. end
  294. return
  295. LHA:
  296. lhatext="Where do YOU wanna "ArchType" to ?"||newline||SelectedFile
  297. lhaGadgets=ArchType" RAM|"Smalltitle
  298. if Window=0 then lharesult=rtezrequest(lhatext,lhaGadgets,"",Tag3,lharesult)
  299. else lharesult=rtezrequest(lhatext,lhaGadgets,"",Tag4,lharesult)
  300. if lharesult=1 then do
  301. call writeln FileShowWindow," ->"ArchType||" to RAM:"
  302. address command
  303. 'lha e ' SelectedFile "RAM:"||Outputtext
  304. ScanDirFlag="RAM:"
  305. end
  306. if lharesult=0 then call writeln FileShowWindow," --Didn't "ArchType" anything"
  307. return
  308. ZIP:
  309. ziptext="Where do YOU wanna "ArchType" to ?"||newline||SelectedFile
  310. zipGadgets=ArchType" RAM|"Smalltitle
  311. if Window=0 then zipresult=rtezrequest(ziptext,zipGadgets,"",Tag3,zipresult)
  312. else zipresult=rtezrequest(ziptext,zipGadgets,"",Tag4,zipresult)
  313. if zipresult=1 then do
  314. call writeln FileShowWindow," ->"ArchType||" to RAM:"
  315. address command
  316. olddirectory=pragma('D','RAM:')
  317. 'unzip ' SelectedFile||' '||Outputtext
  318. address
  319. pragma('D',olddirectory)
  320. ScanDirFlag="RAM:"
  321. end
  322. if zipresult=0 then call writeln FileShowWindow," --Didn't "ArchType" anything"
  323. return
  324. Other:
  325. othertext="Do YOU wanna DO now?"||newline||SelectedFile
  326. otherGadgets="READ IT|EXECUTE|"Smalltitle
  327. if Window=0 then othresult=rtezrequest(othertext,otherGadgets,"",Tag3,othresult)
  328. else othresult=rtezrequest(othertext,otherGadgets,"",Tag4,othresult)
  329. if othresult=1 then do
  330. call writeln FileShowWindow," ->Read the file "
  331. address(port)
  332. 'read' File
  333. busy off
  334. RescanFlag=RescanFlag+1
  335. end
  336. if othresult=2 then do
  337. call writeln FileShowWindow," ->Executing the file "
  338. address(port)
  339. 'execute' File
  340. end
  341. if othresult=0 then call writeln FileShowWindow," --Didn't know what to do with"
  342. return
  343. NIELS:
  344. othertext="Extract file_id.diz to "dos" or NOT ?"||newline||SelectedFile
  345. otherGadgets=dos"|"Smalltitle
  346. if Window=0 then othresult=rtezrequest(othertext,otherGadgets,"",Tag3,othresult)
  347. else othresult=rtezrequest(othertext,otherGadgets,"",Tag4,othresult)
  348. if othresult=1 then do
  349. address command
  350. 'lha e ' SelectedFile ""file_id.diz" ram:"
  351. ScanDirFlag="RAM:"
  352. end
  353.